package com.globant.util.log.details;

import java.util.List;
import org.springframework.dao.DataAccessException;

/**
 * Interface for the Log Details model.
 * 
 * @author gonzalo.zarza
 * @version 20130125v1.2
 */

public interface ILogDetailsDAO {
	
	/* 
	================================================================================================
	 Methods
	================================================================================================
	*/
	/**
	 * Inserts a new record in the log_efficiency table.
	 * 
	 * @param	logEfficiency			record to insert
	 * @throws DataAccessException		if cannot complete the operation
	 */
	public void insertNewLog(LogDetails log) throws DataAccessException;
	
	/* ------------------------------------------------------------------------------------------ */
	
	/**
     * Retrieve records using the log_id column. 
     * 
     * @param logName                   the log id
     * @return                          the records corresponding to log id
     * @throws DataAccessException      if cannot complete the operation
     */
    public List<LogDetails> getLogById(String logId) throws DataAccessException;
    
    /* ------------------------------------------------------------------------------------------ */
	
	/**
	 * Retrieve records using the name column. 
	 * 
	 * @param logName					the log name
	 * @return							the records corresponding to log name
	 * @throws DataAccessException		if cannot complete the operation
	 */
	public List<LogDetails> getLogByName(String logName) throws DataAccessException;
	
	/* ------------------------------------------------------------------------------------------ */
		
	/**
	 * Retrieves the unique id of logs. 
	 * 
	 * @return                          the list of unique id of logs
	 * @throws DataAccessException		if cannot complete the operation
	 */
	public List<String> getUniqueLogsId() throws DataAccessException; 
	
	/* ------------------------------------------------------------------------------------------ */
	
	/**
	 * Updates the efficiency information in the log records who 'status' is 'completed'. 
	 * 
	 * @param logId                    the log id
	 * @param newEfficiency            the new efficiency value
	 * @throws DataAccessException     if cannot complete the operation
	 */
	public void updateEfficiency(String logId, float newEfficiency) throws DataAccessException;
	
	/* ------------------------------------------------------------------------------------------ */
	
	/**
	 * Updates the status of a record specified by the log id.
	 * 
	 * @param logId                     the log id 
	 * @param newStatus					the new status to set
	 * @throws DataAccessException		if cannot complete the operation
	 */
	public void updateLogStatus(String logId, String newStatus) throws DataAccessException;
	
	/* ------------------------------------------------------------------------------------------ */
	
	/**
	 * Deletes the records corresponding to the log name.
	 * 
	 * @param logName					the log name
	 * @throws DataAccessException		if cannot complete the operation
	 */
	public void deleteLogByName(String logName) throws DataAccessException;
	
	/* ------------------------------------------------------------------------------------------ */
    
    /**
     * Deletes the records corresponding to the log id.
     * 
     * @param logId                     the log id
     * @throws DataAccessException      if cannot complete the operation
     */
	public void deleteLogById(String logId) throws DataAccessException;
	
}
